<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"
	import="java.util.*,cn.edu.hit.service.*,cn.edu.hit.javabean.Dictionary" errorPage="error.html"%>
<%@ page import="ConstInfo.AttributeName"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>个人信息修改</title>
<link href="css/main.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/qiuJS.js"></script>
<script type="text/javascript">
function init(delegate, value, target) {
	// window.alert(delegate+value);
	var s = document.getElementById(target);
	/*var option = document.createElement("Option");
	option.setAttribute("value", delegate);
	//option.setAttribute("text",value);
	option.innerHTML = value;*/
	var opt = new Option(value, value);
	// opt.setAttribute("onclick", "test(this.value,this.innerHTML)");
	s.add(opt);
}
</script>
<%
	String username = (String) session.getAttribute("username");
	if (username == null || username.equals("")) {
		out.print("<script>alert('您还没有登录！');location.href='login.html';</script>");
		out.flush();
		return;
	}
%>
</head>
<body onload="loadStudentInfo();">
	<div id="registeForm_div"
		style="position: relative; margin-left: 450px; margin-top: 200px; width: 400px">
		<span style="color:blue;font:'宋体';font-size:28px;">学生个人信息维护</span>
		<form action="UserAction!register.action" method="post"
			name="modifyForm" id="modifyForm">
			<p>
				<label>学号</label> <input type="text" name="student.studentNumber"
					id="number" value="<%=username%>" readonly /><span
					id="hint_number" style="color: red">*</span>
			</p>
			<p>
				<label>姓名</label> <input type="text" name="student.studentName"
					id="name" readonly /><span id="hint_name" style="color: red">*</span>
			</p>
			<p style="margin-left: -16px;">
				<label>原密码</label> <input type="password" name="student.oldPassword"
					id="oldpassword"  /><span
					id="hint_old_password" style="color: red">*</span>
			</p>
			<p style="margin-left: -16px;">
				<label>新密码</label> <input type="password" name="student.password"
					id="password" /><span id="hint_password" style="color: red">*留空则不修改</span>
			</p>
			<p style="margin-left: -32px">
				<label>确认密码</label> <input type="password" name="password2"
					id="password2" /><span id="hint_password2" style="color: red">*</span>
			</p>
			<p>
				<label>民族</label> <input type="text" name="student.nation"
					id="nation" /><span id="hint_nation" style="color: red">*</span>
			</p>
			<p>
				<label>性别</label> <select name="student.sex" id="sex">
				</select>
			</p>
			<p>
				<label>学院</label> <select name="student.college" id="college">
					<option value="">请选择</option>
				</select>
			</p>
			<p>
				<label>专业</label> <select name="student.major" id="major">
					<option value="">请选择</option>
				</select>
			</p>
			<p style="margin-left: -32px">
				<label>政治面貌</label> <select name="student.politic" id="politic">
					<option value="">请选择</option>
				</select>
			</p>
			<p>
				<label>手机</label> <input type="text" name="student.phone" id="phone" />
				<span id="hint_phone" style="color: red">*</span>
			</p>
			<p style="text-align: center; width: 200px">
				<input type="button" class="button" onclick="modifyInfo(this.form);"
					value="修改" /> <input type="button" class="button" value="返回"
					onclick="javascript:location.href='main.html';" />
			</p>
		</form>
	</div>
	<%
		List<Dictionary> genderList = DictionaryService
				.getDictionaryByAttributeName(ConstInfo.AttributeName.GENDER);
		for (int i = 0; i < genderList.size(); i++) {
			int delegate = genderList.get(i).getDelegate();
			String realValue = genderList.get(i).getRealValue();
			//System.out.println(realValue);
			out.print("<script>init('" + delegate + "','" + realValue
					+ "', 'sex');</script>");
		}
		List<Dictionary> collegeList = DictionaryService
				.getDictionaryByAttributeName(ConstInfo.AttributeName.COLLEGE);
		for (int i = 0; i < collegeList.size(); i++) {
			int delegate = collegeList.get(i).getDelegate();
			String realValue = collegeList.get(i).getRealValue();
			//System.out.println("111"+realValue);
			out.print("<script>init('" + delegate + "','" + realValue
					+ "', 'college');</script>");
		}
		List<Dictionary> majorList = DictionaryService
				.getDictionaryByAttributeName(ConstInfo.AttributeName.MAJOR);
		for (int i = 0; i < majorList.size(); i++) {
			int delegate = majorList.get(i).getDelegate();
			String realValue = majorList.get(i).getRealValue();
			//System.out.println(realValue);
			out.print("<script>init('" + delegate + "','" + realValue
					+ "', 'major');</script>");
		}
		List<Dictionary> politicList = DictionaryService
				.getDictionaryByAttributeName(ConstInfo.AttributeName.POLITIC);
		for (int i = 0; i < politicList.size(); i++) {
			int delegate = politicList.get(i).getDelegate();
			String realValue = politicList.get(i).getRealValue();
			//System.out.println(realValue);
			out.print("<script>init('" + delegate + "','" + realValue
					+ "', 'politic');</script>");
		}
	%>
</body>
</html>